#include <iostream>
using namespace std;
void swap(int &a, int &b)
{
	int temp=a;
	a=b;
	b=temp;
}
void partion(int *a, int n)
{
	int i=0;
	int j=n-1;
	while(i<j)
	{
		while(a[i]%2==1)
			i++;
		while (a[j]%2==0)
			j--;
		if(i<j)
		swap(a[i],a[j]);
	}

}

int main()
{
	int a[]={0,1,2,3,4,5,6,7,8,9};
	int len=sizeof(a)/sizeof(a[0]);
	partion(a,len);
	for (int i=0;i<len;i++)
	{
		cout<<a[i]<<" ";
	}
	cout<<endl;
	return 0;
}